package com.example.parkdemo.parking.vr

import android.content.Intent
import android.graphics.BitmapFactory
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.example.base.mvvm.BaseActivity
import com.example.base.net.Const
import com.example.base.user.ParkingResultItem
import com.example.parkdemo.R
import com.example.parkdemo.databinding.ActivityParkingVractivityBinding
import com.example.parkdemo.parking.ParkingViewModel
import com.example.parkdemo.parking.add.AddParkingActivity
import com.google.vr.sdk.widgets.pano.VrPanoramaView
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class ParkingVRActivity : BaseActivity<ActivityParkingVractivityBinding,ParkingViewModel>() {
    override fun initData() {

    }

    override fun initView() {
        val parkingBeanItem = intent.getSerializableExtra(Const.PARAM_PARKING_BEAN) as ParkingResultItem
        binding.vrHeader.headerTitle.text = "车位预览"
        binding.vrHeader.headerBack.setOnClickListener { finish() }
        binding.vrHeader.headerAdd.visibility = View.VISIBLE
        binding.vrHeader.headerAdd.setOnClickListener {
            val intent = Intent(this, AddParkingActivity::class.java)
            intent.putExtra(Const.PARAM_PARKING_BEAN, parkingBeanItem)
            startActivity(intent)
            finish()
        }
        val option = VrPanoramaView.Options()
        option.inputType = VrPanoramaView.Options.TYPE_MONO
        binding.vrView.loadImageFromBitmap(BitmapFactory.decodeResource(resources,R.drawable.ddd),option)
    }

}